<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<table class="display" id="example">
	<thead>
		<tr>
			<th>选择</th>
			<th><strong>标准</strong></th>
			<th><strong>分数</strong></th>
			<th><strong>奖金额度</strong></th>
			<th><strong>备注</strong></th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<s:if test="#request.performances == null || #request.performances.size() <= 0">
			<tr class="gradeX"> <td colspan="6">暂无数据</td> </tr>
		</s:if>
		<s:else>
			<s:iterator value="#request.performances" var="p" status="sta">
				<s:if test="#sta.even"> <tr class="gradeA"> </s:if> <s:else> <tr class="gradeC"> </s:else>
				<td><input type="checkbox" name="chk_salary_performance" value="${p.id}" /></td>
				<td>${p.title}</td>
				<td>${p.scoreEnd}-${p.scoreStart}分</td>
				<td>${p.percentage}</td>
				<td>${p.remark}</td>
				<td style="width: 25%">
                    <a class="button" href="#salary/performance_edit.xhtml?performance.id=${p.id}&<%= new java.util.Date()%>"> <span style="background: url(${ctx}/images/img/page_edit.png)" class="icon">&nbsp;</span>修改</a>
                </td>
				</tr>
			</s:iterator>
		</s:else>
	</tbody>
</table>

<br/><br/>
<div class="grid_12">
    <div class="form-action clearfix">
        <p>
        <span><input type="checkbox" value="1" id="check_all" style="opacity: 100;" onclick="checkAll(this, 'chk_salary_performance')"></span><label for="check_all">&nbsp;全选</label>

        <button type="submit" class="button" onclick="deleteChecked('chk_salary_performance')">批量删除</button>
        <a class="button" href="#salary/performance_edit.xhtml?organizationId=${organizationId}&<%= new java.util.Date()%>"><span style="background:url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加</a>
        </p>
    </div>
</div>

<script type="text/javascript">
    function deleteChecked(checkbox_name){
        var checkIds = findCheckedIds(checkbox_name);
        if(checkIds == null || checkIds.length == 0){
            alert("请删除要删除的项");
            return;
        }
        if(!confirm("确定要删除选中的数据吗？")){
            return;
        }

        var url = "${ctx}/salary/performance_delete.xhtml";
        $.ajax(url, {
            type: "POST",
            data: {"deleteIds":checkIds.join(",")},
            dataType:"html",
            cache:false,
            success:function(a) {
                return pageDownloaded(a, url)
            },
            complete:function() {}
        });
    }
</script>